<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/3/6
  Time: 23:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page isELIgnored="false" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<html>
<head>
    <title>日志管理</title>
</head>
<style>
    .but{
        height: 22px;
        width:70px;
        cursor:pointer;
        background-color: rgb(0,150,136);
        display: inline-block;
        text-align: center;
        color: white;
    }
    .username{
        width: 150px;
        height: 20px
    }
</style>
<body>
<div>
    请输入用户名：<input type="text" id="username" class="username">
    请输入日志操作:<input type="text" id="operation" class="username">
    <div type="button" class="but" onclick="getTable()">搜索</div>
</div>
<table class="layui-hide" id="demo" lay-filter="test"></table>
<script type="text/javascript" src="${path}/webapp/js/layui-public.js"></script>
<script type="text/javascript">
    //模块js均在公共方法中
    function getTable() {
        var table = layui.table //表格
        var username=$("#username").val();
        var operation=$("#operation").val();
        //执行一个 table 实例
        table.render({
            elem: '#demo'
            ,method: 'post'//请求方式
            ,where:{'username':username,'operation':operation}
            ,height: 420
            ,url: '${path}/sys/admin/getAllJournal' //数据接口
            ,title: '用户表'
            ,page: true //开启分页
            ,toolbar: 'default' //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            ,totalRow: true //开启合计行
            ,cols: [[ //表头
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'id', title: 'ID', width:80, sort: true, fixed: 'left'}
                ,{field: 'username', title: '用户名', width:80}
                ,{field: 'operation', title: '操作', width: 200, sort: true, }
                ,{field: 'ip', title: 'IP地址', width:80}
                ,{field: 'createDate', title: '操作日期', width:80}
                ,{fixed: 'right', width: 165, align:'center', toolbar: '#barDemo'}
            ]]
        });
    }
</script>
</body>
</html>
